// 2013-10-6下午01:18:42  net.betou.common.security.encoder.SmsPwdEncoder.java

package net.betou.common.security.encoder;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;

import org.apache.commons.codec.binary.Hex;

/**
 * 短信密码加密， 32位，小写
 * @author 叶装装
 */
public class SmsMd5PwdEncoder extends Md5PwdEncoder{

	@Override
	public String encodePassword( String rawPass ) {

		MessageDigest messageDigest = getMessageDigest( );
		byte [ ] digest;
		try{
			digest = messageDigest.digest( rawPass.getBytes( "UTF-8" ) );
		}catch( UnsupportedEncodingException e ){
			throw new IllegalStateException( "UTF-8 not supported!" );
		}
		
		return new String( Hex.encodeHex( digest ) );
	}

}
